#include "simple_darr.hpp"

template <class T>
void DynamicArr<T>::addToEnd( const_reference_type o ) {
  expand();
  _heap_mem_[_size++] = o;
}

template <class T>
void DynamicArr<T>::expand() {
  if ( _size >= _capacity / 2 ) {
    pointer_type old = _heap_mem_;
    _heap_mem_ = new value_type[_capacity * 2];
    _capacity *= 2;
    for ( size_type i = 0; i < _capacity; i++ ) {
      _heap_mem_[i] = old[i]
    }
    delete[] old;
  }
}